<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/jquery-3.4.1.min.js"></script>
</head>
<body>
    <div class="d1">
        <a href="">百度一下</a>
        <p>qqqqqqqqqq</p>
        <span>5515</span>
    </div>

    <ul>
        <li>11111</li>
        <li>222222222</li>
        <li>3333333</li>
        <li>4444444</li>
        <li>5555555</li>
    </ul>
    <script>
        console.log($('.d1').children('p').siblings())
        // 遍历孩子p的同胞元素
        console.log($('.d1').find('span'))
        //查找孩子某一个元素
        $('.d1').children().each(function(i,item){
            console.log(item)
        })
        //第二种$.each(数组，function())
        let $childs = $('.d1').children()
        $.each($childs,function(i,item){
            console.log(item)
        })

        $('li').first().css('background',"red").end().last().css('background',"green")
        // end()是结束前面的筛选，然后将元素集合还原成初始状态。
    </script>
</body>
</html>